package com.heng.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heng.dao.entity.user.UserEntity;
import com.heng.dao.mapper.UserMapper;
import com.heng.service.UserService;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> implements UserService {

    // 按手机号查询用户
    @Override
    public UserEntity getByPhone(String phone) {
        return baseMapper.selectByPhone(phone);
    }

    // 分页查询用户
    @Override
    public IPage<UserEntity> pageQuery(Integer pageNum, Integer pageSize) {
        LambdaQueryWrapper<UserEntity> queryWrapper = new LambdaQueryWrapper<UserEntity>();
//                .eq(UserEntity::getDelFlag, 0); // 逻辑删除过滤（若有）
        return baseMapper.selectPage(new Page<>(pageNum, pageSize), queryWrapper);
    }
}